xen/arm: Retrieve the correct number of cells when building dom0 DT
authorJulien Grall <julien.grall@citrix.com>
Tue, 29 Sep 2015 16:21:36 +0000 (17:21 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 1 Oct 2015 12:51:29 +0000 (13:51 +0100)
commit93be027d51dc6e7c9b4cd071d08194cc6c2306e0
treea5d67da5b881dacae9b95ab475fdf470169490c6
parenta0542500a9ac029e46cce5f7c51378cf192c7055
xen/arm: Retrieve the correct number of cells when building dom0 DT

The functions dt_n_*_cells return the number of cells for a "reg"
property of a given node. So those numbers won't be correct if the
parent of a given node is passed.

This is fine today because the parent is always the root node which
means there is no upper parent.

Introduce new helpers dt_child_n_*_cells to retrieve the number of
cells for the address and size that can be used to create the "reg"
property of the immediate child of a given parent. Also introduce
dt_child_set_range to pair up with dt_child_n_*_cells.

Use the new helpers when creating the hypervisor and memory node where
we only have the parent in hand. This is because those nodes are created
from scratch by Xen and therefore we don't have a dt_device_node for
them. The only thing we have is a pointer to their future parent.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/domain_build.c
xen/common/device_tree.c
xen/include/xen/device_tree.h